////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012 Kentaro Sekimoto  All rights reserved.
////////////////////////////////////////////////////////////////////////////

#ifndef _FM4_FRAM_H_
#define _FM4_FRAM_H_ 1

#include <tinyhal.h>

struct FM4_FRAM_Driver
{
    typedef UINT16 CHIP_WORD;

    static BOOL ChipInitialize(void *context);
    static BOOL ChipUnInitialize(void *context);
    static const BlockDeviceInfo* GetDeviceInfo(void *context);
    static BOOL Read(void *context, ByteAddress Address, UINT32 NumBytes, BYTE *pSectorBuff);
    static BOOL Write(void *context, ByteAddress Address, UINT32 NumBytes, BYTE *pSectorBuff, BOOL ReadModifyWrite);
    static BOOL Memset(void *context, ByteAddress Address, UINT8 Data, UINT32 NumBytes);
    static BOOL GetSectorMetadata(void* context, ByteAddress SectorStart, SectorMetadata *pSectorMetadata);
    static BOOL SetSectorMetadata(void* context, ByteAddress SectorStart, SectorMetadata *pSectorMetadata);
    static BOOL IsBlockErased(void *context, ByteAddress BlockStart, UINT32 BlockLength);
    static BOOL EraseBlock(void *context, ByteAddress Address);
    static void SetPowerState(void *context, UINT32 State);
    static UINT32 MaxSectorWrite_uSec(void *context);
    static UINT32 MaxBlockErase_uSec(void *context);
};

#endif // _FM4_FRAM_H_

